package base.Day05;

import java.util.Arrays;
import java.util.Random;

public class MaxOfArray
{
    public static void main(String[] args)
    {
        MaxOfArray maxOfArray = new MaxOfArray();
        maxOfArray.minOfArray();
    }


    void test()
    {
        int[] arr = new int[10];
        int max = arr[0];
        for (int i = 0 ; i < arr.length ; i++)
        {
            arr[i] = new Random().nextInt(100);
            System.out.println(arr[i]);
            max = (Math.max(max, arr[i])) ;
//            max = (max < arr[i] ? arr[i] : max) ;
        }
        System.out.println("max = "+max);
        int[] arr1 = Arrays.copyOf(arr,10);
    }

    void minOfArray()
    {
        int[] arr = new int[10];
        for (int i = 0 ; i < arr.length;i++)
        {
            arr[i] = (int)(Math.random()*100);
            System.out.println(arr[i]);
        }
        int min = arr[0];
        for (int j = 0 ; j < arr.length; j++)
        {
            min = Math.min(min,arr[j]);
        }
        System.out.println("min = " + min );
    }



}
